import 'babel-polyfill';
var ReactDOM = require("react-dom");
import React, { Component } from 'react';

import { Provider } from 'react-redux';
import configureStore from '../store/configureStore.js';
import { Router, Route, Link ,hashHistory,IndexRoute , Redirect} from 'react-router';
import Frame from '../page/frame/index.js';
import "../styles/app.scss";
// try{
//     window.tenantId = location.search.match(/tenantId=\w+/)[0].split("=")[1];
// }catch(e){
//     throw new Error(e);
// }
//路由
// alert(location.href)
// alert(JSON.stringify(bmnative))
const route = (
    <Router history={hashHistory}>
        <Route path="/" component={Frame}>
            <Route path="article(/id/:id)(/title/:title)(/token/:token)" getComponent={(location, callback) => {
                 require.ensure([], function(require) {
                    callback(null, require('../page/article').default);
                })
             }}/>
             <Route path="news(/id/:id)(/title/:title)(/token/:token)" getComponent={(location, callback) => {
                 require.ensure([], function(require) {
                    callback(null, require('../page/news').default);
                })
             }}/>
        </Route>
    </Router>
);

ReactDOM.render(
    <Provider store={configureStore()}>
        {route}
    </Provider>,
    document.getElementById('root')
);